// Created by Administrator on 2015/11/27.

extends ../public/pretty_layout
block content
    .container(ng-controller='recipe_details')
        if(login_user)
            #addToMenuModal.modal.fade(role='dialog' aria-labelledby='modal_label' aria-hidden='true')
                .modal-dialog
                    .modal-content
                        .modal-header
                            button.close(type='button' data-dismiss='modal' aria-hidden='true') &times;
                            h4#modal_label.modal-title 添加到菜单
                        .modal-body
                            form.form-horizontal(role='form' name='athena' method='post' action='/user/private/#{login_user.nick}/menu/add/recipe')
                                input(type='hidden' value='#{recipe.id}' name='rid' ng-init='rid=#{recipe.id}')
                                .form-group
                                    label.col-sm-3.control-label(for='menu') 菜单：
                                    .col-sm-5: select.form-control(name='mid' ng-model='mid' ng-init='mid=0')
                                            option(value='0') ----选择菜单----
                                            option(ng-repeat='menu in menus' value='{{menu.id}}') {{menu.name}}
                                .modal-footer(style='margin:30px -15px -15px -15px')
                                    button.btn.btn-default(type='button' data-dismiss='modal') 关闭
                                    button.btn.btn-primary(type='button' ng-click='postToSave()') 提交

        ol.breadcrumb
            li: a(href='/') 首页
            li: a(href='/recipe') 菜谱
            li: a(href='/recipe/details/#{recipe.id}') #{recipe.title}
        .recipe-details(ng-controller='recipe$details')
            .summary
                div.image
                    img(src="#{recipe.finishedProductImage}")
                div(style='margin-left:300px;height:400px;')
                    div(style='padding:20px;')
                        div
                            span.title.left #{recipe.title}
                            ul.horizontal-menu.right
                                if(login_user)
                                    li: button.btn.btn-xs.btn-danger(ng-click='addToMenu("#{login_user.nick}")'): span.glyphicon.glyphicon-th-list
                                li.text-center
                                    if(!collected)
                                        a(href='javascript:;' ng-click='collect(#{recipe.id}, $event)' ng-init='collect_count=#{recipe.collect}' ng-cloak) 收藏(#{recipe.collect})
                                    else
                                        a(href='javascript:;') 已收藏(#{recipe.collect})
                                li.text-center
                                    if(!upvoted)
                                        a(href='javascript:;' ng-click='upvote(#{recipe.id}, $event)' ng-init='upvote_count=#{recipe.upvote}' ng-cloak) 点赞(#{recipe.upvote})
                                    else
                                        a(href='javascript:;') 已点赞(#{recipe.upvote})
                        div
                            - var keywords = recipe.keyword && recipe.keyword.split(',') || []
                            each word in keywords
                                span.keyword #{word}
                        p 难度：#{recipe.diff.name}
                        p 花费时间：#{recipe.spend.name}
                        p 工艺：#{recipe.craftwork.name || '无'}
                        p 口味：#{recipe.flavour.name || '无'}
                        p 作者：#{recipe.user.nick}
                        p: a(href='/user/#{recipe.user.nick}'): img(src='#{recipe.user.portrait}' width=50 height=50)
                        p 菜谱：#{recipe.user.count.recipe} / 菜单：#{recipe.user.count.menu} / 关注：#{recipe.user.count.focus} / 粉丝：#{recipe.user.count.fans}
            div(style='padding:20px 50px;')
                h2 背景小故事
                p.content #{recipe.backgroundStory}
                h2 用料
                div(style="width:400px;")
                    table.table.table-bordered
                        each value, key in recipe.ingredient
                            tr
                                th #{key}
                                td #{value}
                h2 制作方法
                table.table.table-bordered
                    each item in recipe.step
                        tr
                            th(style='width:50px;') #{item.index}
                            td #{item.content}
                            td(style='width:130px;')
                                if(item.image)
                                    img(src='#{item.image}' width=100 height=100)
                h2 小技巧
                p.content #{recipe.knack}
